package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.dto.DishPageQueryDTO;
import com.sky.entity.Dish;
import com.sky.enumeration.OperationType;
import com.sky.vo.DishVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface DishMapper {

    @AutoFill(OperationType.INSERT)
    void insert(Dish dish);

    //根据分类id查询菜品数量
    @Select("select count(*) from dish where category_id = #{categoryId}")
    Long countByCategoryId(Long categoryid);

    List<DishVO> list(DishPageQueryDTO pageQueryDTO);

    Long countByStatus(List<Long> ids);

    //批量删除
    void deleteByIds(List<Long> ids);

    Dish getById(Long id);

    @AutoFill(OperationType.UPDATE)
    void update(Dish dish);

    List<Dish> getList(Long categoryId, String name);

    List<DishVO> getBycategoryId(Dish dish);
}
